#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
ll inf = 0x3f3f3f3f3f3f3f3f;
void solve()
{
    ll n;
    cin >> n;
    vector<ll> a(n + 1);
    vector<ll> cnt(n + 1);
    ll mx = inf;
    ll l = inf;
    ll r = 0;
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i + 1];
        mx = min(mx, a[i + 1]);
        if (a[i + 1] == 0)
        {
            cnt[i + 1]++;
            l = min(l, i + 1);
            r = max(r, i + 1);
        }
    }
    for (ll i = 1; i <= n; i++)
    {
        cnt[i] += cnt[i - 1];
    }
    if (mx)
    {
        cout << 1 << endl;
        cout << 1 << " " << n << endl;
        return;
    }
    if (l == r)
    {
        if (l == 1)
        {
            cout << 2 << endl;
            cout << 1 << " " << 2 << endl;
            cout << 1 << " " << n - 1 << endl;
        }
        else if (l == n)
        {
            cout << 2 << endl;
            cout << n - 1 << " " << n << endl;
            cout << 1 << " " << n - 1 << endl;
        }
        else
        {
            cout << 2 << endl;
            cout << 1 << " " << l << endl;
            cout << 1 << " " << n - l + 1 << endl;
        }
    }
    else
    {
        if ((l != 1) || (r != n))
        {
            cout << 2 << endl;
            cout << l << " " << r << endl;
            cout << 1 << " " << n - (r - l) << endl;
        }
        else
        {
            cout << 3 << endl;
            cout << 3 << " " << n << endl;
            cout << 1 << " " << 2 << endl;
            cout << 1 << " " << 2 << endl;
        }
    }

    return;
}
int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    ll _;
    cin >> _;
    while (_--)
        solve();
}